<?php
function SigHandler($signo)
{
    fprintf(STDOUT,"pid=%d,我接收到一个信号:%d\n",getmypid(),$signo);
}
pcntl_signal(SIGINT,"sigHandler");
pcntl_signal(SIGUSR1,"sigHandler");
pcntl_signal(SIGUSR2,SIG_IGN);

$pid = pcntl_fork();
if ($pid){
    pcntl_signal(SIGUSR1,function (){
       fprintf(STDOUT,"子进程我收到中断信号了，然后我没事做了...\n");
    });
}
while (1){
    pcntl_signal_dispatch();
    fprintf(STDOUT,"pid=%d,main process 在做一些事情...\n",getmypid());
    sleep(1);
}
